#!/bin/sh
# sudo apt install -y --install-suggestion texlive texlive-lang-chinese texlive-xetex texlive-science
DOWNLOAD_DIR=~/下载

download_texlive () {
	TEXLIVE_URL=https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/Images/texlive2024.iso
		TEXLIVE=texlive2024.iso
		if [ ! -f ${DOWNLOAD_DIR}/${TEXLIVE} ]; then
			wget -o ${DOWNLOAD_DIR}/${TEXLIVE} ${TEXLIVE_URL}
	fi
}


download_font () {
	FONT_URL_PREFIX=https://mirrors.tuna.tsinghua.edu.cn/CTAN/fonts/fandol
	FONT_LOCATION=/usr/share/fonts/truetype/fandol
	FONT=${1}

	if [ ! -w ${FONT_LOCATION} ]; then
		sudo chmod a+w ${FONT_LOCATION}
	fi
	if [ ! -f ${FONT_LOCATION}/${FONT} ]; then
		wget -o ${FONT_LOCATION}/${FONT} ${FONT_URL_PREFIX}/${FONT}
	fi
}

FONT_SONG=FandolSong-Regular.otf
FONT_SONG_BOLD=FandolSong-Bold.otf
FONT_HEI=FandolHei-Regular.otf
FONT_HEI_BOLD=FandolHei-Bold.otf
FONT_KAI=FandolKai-Regular.otf
FONT_FANG=FandolFang-Regular.otf

download_font ${FONT_SONG}
download_font ${FONT_SONG_BOLD}
download_font ${FONT_HEI}
download_font ${FONT_HEI_BOLD}
download_font ${FONT_KAI}
download_font ${FONT_FANG}

